#include <iostream>
#include "util/logger.h"
#include "util/base_types.h"
#include <thread>
#include <gtest/gtest.h>
#include <vector>

using namespace TinyDB;

void th_fuc(int arg) {
	TinyDB::LOG_TRACE("%s = %d", "arg", arg);
}

TEST(LOG_TEST, TEST1) {
	Logger::SetLogTarget(LOG_TARGET_BOTH);
	Logger::SetLogLevel(LOG_LEVEL_TRACE);
	t_uint64 idx = 0;
	t_uint64 n = 2;
	for (; idx < n; idx++) {
	  LOG_DEBUG("log debug: idx = %d", idx);
	}
}

TEST(LOG_TEST, TEST2) {
	using namespace std;
	Logger::SetLogTarget(LOG_TARGET_BOTH);
	Logger::SetLogLevel(LOG_LEVEL_TRACE);

	t_uint32 th_num = 2;
	t_uint32 th_idx = 0;
	vector<thread> th_vec;
	for (; th_idx < th_num; th_idx++) {
		th_vec.push_back(thread(th_fuc, th_idx));
	}
	th_idx = 0;
	for (; th_idx < th_num; th_idx++) {
		th_vec[th_idx].join();
	}
}


